package
{
	import com.demonsters.debugger.MonsterDebugger;
	import com.mindshifter.pivotaltracker.services.v3.core.Token;
	import com.mindshifter.pivotaltracker.services.v3.core.Tracker;
	import com.mindshifter.pivotaltracker.services.v3.core.TrackerUser;
	import com.mindshifter.pivotaltracker.services.v3.events.TrackerEvent;
	
	import flash.display.Sprite;
	
	/**
	 * 
	 * @author Mindshifter
	 * 
	 */
	public class PivotalTracker extends Sprite
	{
		
		public var traker:Tracker;
		public var user:TrackerUser;
		public var token:Token = new Token("f55c3c0330e850427194fcbb3226612c",11232);
		
		public function PivotalTracker()
		{
			MonsterDebugger.initialize(this);
			user = new TrackerUser("cazacu84@gmail.com","Bravo999",token);
			traker = new Tracker(user);
			traker.login();
			traker.addEventListener(TrackerEvent.TRACKER_USER_LOGGED_IN,trackerUserLogin);
			traker.addEventListener(TrackerEvent.TRACKER_USER_NOT_EXISTS,trackerUserNotExistLogin);
			//traker.getProjects();
			
		}
		private function trackerUserLogin(event:TrackerEvent):void
		{
			MonsterDebugger.trace(this,"Hello "+user.username,"Mindshifter","LOGIN",0xff7800);
			MonsterDebugger.trace(this,event.trackerDataXml);			
		}
		private function trackerUserNotExistLogin(event:TrackerEvent):void
		{
			MonsterDebugger.trace(this,event.trackerDataXml);
		}
	}	
}